﻿#ifndef HNRJITMANAGER_H
#define HNRJITMANAGER_H

#include "HnrjitDialog.h"

class DIRECTUI_API CHnrjitManager : public CHnrjitDialog
{
public:
	explicit CHnrjitManager();
	virtual ~CHnrjitManager();

	/// <summary>加载XML界面文件</summary>
	/// <param name="pszXmlPath">XML文件路径</param>
	/// <param name="pszZipPath">ZIP文件路径</param>
	/// <returns>是否加载成功</returns>
	virtual BOOL LoadFromFile(const TCHAR* pszXmlPath, const TCHAR* pszZipPath = NULL);

	/// <summary>删除所有界面元素</summary>
	virtual void RemoveAllElement();

protected:
	/// <summary>创建子窗口对象</summary>
	/// <param name="dwClsid">类ID</param>
	/// <returns>窗口对象</returns>
	void AddControls(const TiXmlElement* xmlContainer, HZIP hZipRes);

	/// <summary>创建容器</summary>
	/// <param name="dwClsid">类ID</param>
	/// <returns>控件指针</returns>
	virtual CHnrjitContainer* CreateContainer(DWORD dwClsid);

	/// <summary>创建控件</summary>
	/// <param name="dwClsid">类ID</param>
	/// <param name="dwClsid">类ID</param>
	/// <returns>控件指针</returns>
	virtual CHnrjitControl* CreateControl(DWORD dwClsid);

	/// <summary>加载XML界面元素</summary>
	/// <param name="xmlDocument">XML文档对象</param>
	/// <param name="hZipArchive">ZIP资源句柄</param>
	/// <returns>是否加载成功</returns>
	BOOL SetupXmlUi(TiXmlDocument* xmlDocument, HZIP hZipArchive);

protected:
	CAtlArray<CHnrjitWigdet*> m_arrWidgets; // 窗口集合
};

#endif // HNRJITMANAGER_H